package br.com.agenda.dao;

import java.util.List;

import org.apache.tapestry5.hibernate.annotations.CommitAfter;

public interface GenericDAO
{
   public static final int ASC_ORDER = 0;
   public static final int DESC_ORDER = 1;
   
   @CommitAfter
   public void saveOrUpdate(Object entity);

   @CommitAfter
   public void deleteById(long id, Class<?> entityClass);
     public Object getById(long id, Class<?> entityClass);

   public List<?> getList(Class<?> entityClass);

   public List<?> getListOrderBy(Class<?> entityClass
           , String fieldToOrderBy, int order);

   public List<?> getListByFieldEqualsValue(Class<?> entityClass
           , String fieldName, long fieldValue);

   public List<?> getListByFieldILikeValue(Class<?> entityClass
           , String fieldName, String fieldValue);

   public List<?> getListOfTheseFields(Class<?> entityClass, String... fieldsToRead);

} 